<style>
    .goods-img{
        max-width: 50px;
        max-height: 50px;
    }

    .form-horizontal{
        background: #fff;
    }
</style>


<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    
        <!-- 已发货订单不能更改收货地址 -->
        <div class="form-group">
            <label for="c-user_id" class="control-label col-xs-12 col-sm-2">收货地址:</label>
            <div class="col-xs-12 col-sm-8">
                <p class="form-control-static">{$row.recipients} {$row.mobile}</p>
                <p class="form-control-static">{$row.pname} {$row.cname} {$row.aname}{$row.address}</p>
            </div>
        </div>



        <div class="form-group">
            <label for="c-shipping_id" class="control-label col-xs-12 col-sm-2">物流公司:</label>
            <div class="col-xs-12 col-sm-8">
                <select name="row[shipping_id]" id="c-shipping_id" class="form-control">
                    <option value="">请选择</option>
                    {volist name="shippings" id="s"}
                        <option value="{$s.id}">{$s.name}</option>
                    {/volist}
                </select>
            </div>
        </div>

        <div class="form-group">
            <label for="c-shipping_code" class="control-label col-xs-12 col-sm-2">物流单号:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-shipping_code"  class="form-control" name="row[shipping_code]" type="text" value="{$row.shipping_code}">
            </div>
        </div>
        

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>

    <div class="form-group">
        <label for="c-user_id" class="control-label col-xs-12 col-sm-2">商品列表:</label>
        <div class="col-xs-12 col-sm-8">
            <table class="table table-bordered table-hover">
                <tr class="alert-success">
                    <th>图片</th>
                    <th>名称</th>
                    <th>数量</th>
                    <th>价格</th>
                </tr>
                {foreach name="goods" id="item"}
                    <tr>
                        <td>
                            <img src="{$item.original_image}" alt="" class="img-responsive goods-img">
                        </td>
                        <td>
                            <p>{$item.goods_name}</p>
                            <p>{$item.spec_name}</p>
                        </td>
                        <td>{$item.number}</td>
                        <td>{$item.price}</td>
                    </tr>

                {/foreach}
            </table>

        </div>
    </div>
</form>


<script>
    //区取下级地区
    function getNextArea(th, id){
        var aid = $(th).val();
        var str = '<option value="">请选择</option>';
        $('#'+id).html(str);
        $('#area_id').html(str);
        if(aid){
            $.ajax({
                url: '{:url("Base/getNextArea")}',
                type: 'post',
                dataType: 'json',
                data: {aid: aid},
                success:function(res){
                    if(res.code){
                        res.data.forEach(function(item){
                            str += '<option value="'+item.id+'">'+item.areaname+'</option>'
                        });
                        $('#'+id).html(str);
                    }
                }
            })
            .fail(function() {
                console.log("error");
            });
            
        }
    }
</script>
